package com.niit.service.impl;

import com.niit.dao.UnitMapper;
import com.niit.pojo.Unit;
import com.niit.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UnitServiceImpl implements UnitService {
    @Autowired
    private UnitMapper unitMapper;

    @Override
    public int addUnit(Unit unit) {
        return unitMapper.addUnit(unit);
    }

    @Override
    public Unit getUnitById(int id) {
        return unitMapper.getUnitById(id);
    }

    @Override
    public List<Unit> getAllUnits() {
        return unitMapper.getAllUnits();
    }

    @Override
    public int updateUnit(Unit unit) {
        return unitMapper.updateUnit(unit);
    }

    @Override
    public int deleteUnit(int id) {
        return unitMapper.deleteUnit(id);
    }

    @Override
    public int selectIdByName(String unit_name) {

        return unitMapper.selectIdByName(unit_name);
    }
}
